{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Pandas Date and Time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn; seaborn.set()\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Working with Timestamp\n",
    "\n",
    "For points in time, Pandas provides the `Timestamp` type. \n",
    "\n",
    "It is a replacement for Python's native `datetime`, but is based on the more efficient `numpy.datetime64` data type. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can create a simple date time as a `Timestamp` using the Pandas `to_datetime` functions which takes a string to parse:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2018-10-14 00:00:00')"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "date = pd.to_datetime(\"14th of October, 2018\")\n",
    "date"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can also use the Timestamp constructor directly"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2018-10-14 12:00:30\n",
      "<class 'pandas._libs.tslibs.timestamps.Timestamp'>\n",
      "2018-10-14 12:00:30\n",
      "<class 'datetime.datetime'>\n"
     ]
    }
   ],
   "source": [
    "date = pd.Timestamp(year=2018, month=10, day=14, hour=12, minute=0, second=30)\n",
    "python_datetime = date.to_pydatetime()\n",
    "print(date)\n",
    "print(type(date))\n",
    "print(python_datetime)\n",
    "print(type(python_datetime))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "There are multiple attributes that let you access the information stored in a Timestamp object. \n",
    "\n",
    "You can find the full list here: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Timestamp.html#pandas.Timestamp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "14\n",
      "287\n",
      "41\n",
      "10\n",
      "2018\n",
      "12\n",
      "0\n",
      "30\n"
     ]
    }
   ],
   "source": [
    "print(date.day)\n",
    "print(date.dayofyear)\n",
    "print(date.week)\n",
    "print(date.month)\n",
    "print(date.year)\n",
    "print(date.hour)\n",
    "print(date.minute)\n",
    "print(date.second)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Working with Time Series"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "datetimes = pd.DatetimeIndex(['2014-07-04', '2014-08-04',\n",
    "                          '2015-07-04', '2015-08-04'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2014-07-04', '2014-08-04', '2015-07-04', '2015-08-04'], dtype='datetime64[ns]', freq=None)"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "datetimes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "series = pd.Series([10, 4, 14, 30], index=datetimes)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2014-07-04    10\n",
       "2014-08-04     4\n",
       "2015-07-04    14\n",
       "2015-08-04    30\n",
       "dtype: int64"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "series"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2015-07-04    14\n",
       "2015-08-04    30\n",
       "dtype: int64"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "series['2015']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pandas.core.series.Series"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(series)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x1a22868048>"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAD+CAYAAAA9HW6QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3XtYU3e+LvA3IVzlDgkgIDdRvIJTa6FW0VLxSrV213qrx5nT6nS3dtqzZ6rlYY6dOVu3szt7fOrUds6Z3ZmePb1qu3WrVXtsVawXxuIFEESUEATCTYKEayDJOn9gUrRWSQxZWeT9/GWAJC9I3iy+67fWkgmCIICIiNyGXOwARETkXCx+IiI3w+InInIzLH4iIjfD4icicjMsfiIiN8PiJyJyMyx+IiI3w+InInIzLH4iIjfD4icicjMsfiIiN6MQO8BAra2dMJsHf864sDB/tLR0DGGioSXl/MzuXFLMbMHsQ0culyEkZITN93Op4jebBZuK33IfKZNyfmZ3LilmtmB218JRDxGRm2HxExG5GRY/EZGbsbv43377bSxYsAALFy7EX//6VwDA6dOnkZOTg+zsbGzfvt1hIYmIyHHs2rl79uxZFBQUYN++fTAajViwYAEyMjKQm5uLv/3tb4iKisL69euRn5+PzMxMR2cmIqIHYNcW/7Rp0/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p6amho899xzOHDgAPz9/VFdXY3q6mp0dHRg8uTJiImJGcr3qAfC7OKQYnYpZrZgdhoMm07SVlNTg6ysLDQ3N+MXv/gFgoKC8MYbb0jidKbMLg4pZpdiZgtmp8GwqfjLy8vx0UcfoaSkBM888wyeeeaZocrlcMwuDilml2JmC2anwbBp1PPFF1+goaEBL7zwgvXwaKlgdnFIMbsUM1swOw2GTcUvSPjc1cwuDilml2JmC2anwbCp+ImISPp42joiIjfD4icicjMsfiIiN8PiJyJyMyx+IiI3w+InInIz/x8UbBtPHi/pDwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "series.plot()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Create a range of dates\n",
    "You can simple create a range of dates by providing two dates interval. By default, the interval is one day."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "dates = pd.date_range('2015-07-03', '2015-07-10')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can also be more specific by deciding how many periods and what unit to use for the frequency. E.g. here `W` means week."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2018-10-07', '2018-10-14', '2018-10-21', '2018-10-28',\n",
       "               '2018-11-04', '2018-11-11', '2018-11-18', '2018-11-25',\n",
       "               '2018-12-02', '2018-12-09'],\n",
       "              dtype='datetime64[ns]', freq='W-SUN')"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "weeks = pd.date_range('2018 Oct 1', periods = 10, freq = 'W')\n",
    "weeks"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Timedelta"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Pandas allow you to do arithmetic which returns deltas:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "TimedeltaIndex([ '0 days',  '7 days', '14 days', '21 days', '28 days',\n",
       "                '35 days', '42 days', '49 days', '56 days', '63 days'],\n",
       "               dtype='timedelta64[ns]', freq=None)"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "weeks - weeks[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exercises"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's retrieve stock data from Google using the Yahoo API.\n",
    "This will be represented as a time series by date."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "ename": "ImportError",
     "evalue": "cannot import name 'is_list_like'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mImportError\u001b[0m                               Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-34-d6b6360f8c78>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpandas_datareader\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m goog = data.DataReader('GOOG', start='2017', end='2019',\n\u001b[1;32m      4\u001b[0m                        data_source='yahoo')\n\u001b[1;32m      5\u001b[0m \u001b[0mgoog\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/envs/cspark/lib/python3.6/site-packages/pandas_datareader/__init__.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0m_version\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mget_versions\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m from .data import (DataReader, Options, get_components_yahoo,\n\u001b[0m\u001b[1;32m      3\u001b[0m                    \u001b[0mget_dailysummary_iex\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mget_data_enigma\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mget_data_famafrench\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m                    \u001b[0mget_data_fred\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mget_data_google\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mget_data_moex\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      5\u001b[0m                    \u001b[0mget_data_morningstar\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mget_data_quandl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mget_data_stooq\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/envs/cspark/lib/python3.6/site-packages/pandas_datareader/data.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m     12\u001b[0m     \u001b[0mImmediateDeprecationError\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     13\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mpandas_datareader\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfamafrench\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mFamaFrenchReader\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 14\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpandas_datareader\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfred\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mFredReader\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     15\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mpandas_datareader\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgoogle\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdaily\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mGoogleDailyReader\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     16\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mpandas_datareader\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgoogle\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moptions\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mOptions\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mGoogleOptions\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/anaconda3/envs/cspark/lib/python3.6/site-packages/pandas_datareader/fred.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpandas\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcore\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcommon\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mis_list_like\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      2\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mpandas\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mconcat\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mread_csv\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mpandas_datareader\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbase\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0m_BaseReader\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mImportError\u001b[0m: cannot import name 'is_list_like'"
     ]
    }
   ],
   "source": [
    "from pandas_datareader import data\n",
    "\n",
    "goog = data.DataReader('GOOG', start='2017', end='2019',\n",
    "                       data_source='yahoo')\n",
    "goog.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "goog['Close'].plot()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Find the date for the highest closing price in 2018"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "max_val= goog['Close'].max()\n",
    "x = pd.Series([max_val], index=[date])\n",
    "x\n",
    "\n",
    "#goog['Close'].idmax()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Find the median closing price in 2018"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "goog['Close']['2018'].median()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Find the average closing prince in July 2018"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "goog['Close']['2018-07'].mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Timezones"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "london = pd.Timestamp.now(tz=\"Europe/London\")\n",
    "brussels = london.tz_convert(\"Europe/Brussels\")\n",
    "print(london)\n",
    "print(brussels)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
